package c2c.dogExample;

import java.lang.ref.*;
public final  class SingletonDog
    extends Dog
{
//============= F I E L D S ======================
static private WeakReference singleton = null;

//============= C O N S T R U C T O R S ==========
private SingletonDog(Object p0)
{
    super(p0);
    if (singleton!=null && singleton.get()!=null)
        throw new RuntimeException("Singleton constructor failure");
    singleton = new WeakReference( this );
}

//============= M E T H O D S ====================
static public SingletonDog getInstance(Object p0)
{
    if (singleton==null || singleton.get()==null)
        new SingletonDog(p0);
    return (SingletonDog)singleton.get();
}

//============= N E S T E D   C L A S S E S ======
}
